<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>

        div {
            border: 2px solid black;
            background: yellow;
            width: 240px;
            height: 200px;
            margin: 20px;
            color: black;
            resize: vertical;
            overflow: auto;
            padding: 20px;
        }

        .ghost-center {
            position: relative;
        }

        .ghost-center::before {
            content: " ";
            display: inline-block;
            height: 100%;
            width: 1%;
            vertical-align: middle;
        }

        .ghost-center p {
            display: inline-block;
            vertical-align: middle;
            width: 190px;
            margin: 0;
            padding: 20px;
            background: burlywood;
        }
    </style>
</head>
<body>
<div class="ghost-center">
    <p>
        测试测试测试测试测试测试测试测试测试测试测试测试测
    </p>
</div>
</body>
</html>